const express = require("express")
const { getCode } = require("../service/captchService")
const { formatResponse } = require("../utils/tool")

const router = express.Router()

router.get("/", async function(req, res, next) {
    const code = await getCode()
    req.session.captcha = code.text
    res.setHeader("Content-Type", "image/svg+xml")
        // res.send(formatResponse(0, "", code.data))
    res.send(code.data)
})


module.exports = router